package com.zzh.interview.controller;

import com.zzh.interview.annotation.HotKeyCache;
import com.zzh.interview.annotation.TestHot;
import com.zzh.interview.common.BaseResponse;
import com.zzh.interview.common.ResultUtils;
import com.zzh.interview.model.dto.TestRequest;
import org.springframework.web.bind.annotation.*;

/**
 * @author 张 志 豪
 * @version 1.0
 */
@RestController
@RequestMapping("/test")
public class TestController {

    @TestHot//自定义注解切面
    @PostMapping("/hello")
    public String hello(@RequestBody TestRequest testRequest) {
        return "Hello World!" + testRequest.getName() + testRequest.getAge();
    }

    @HotKeyCache(keyPrefix = "test_key")//自定义注解切面
    @PostMapping("/helloTest")
    public BaseResponse<String> helloTest(@RequestBody TestRequest testRequest) {
        System.out.println("hello");
        return ResultUtils.success("Hello World!" + testRequest.getName() + testRequest.getAge());
    }
}
